
<h2>ข้อมูลคลังความรู้</h2>
<? if(permission($menu_id, 'canadd')!=''){ ?> 
<div id="btnBox" align="right"><a href="<?=$urlpage;?>/form" style="text-decoration:none;"><input type="button" class="ui-state-active ui-corner-all btnAdd" value="เพิ่มรายการ"></a></div>
<? } ?> 
<div id="paging" class="pagination">
<?php echo $pagination;?>
</div>
<form>
<fieldset>
	<legend>ค้นหา</legend>
	<table>
		<tr height="25px">
		<td width="150px">ชื่อรายการ         :</td>
		<td><input type="text" name="search" value="<?=@$_GET['search'];?>" size="40"></td>		
		</tr>	
		<tr height="25px">
		<td>ประเภทข้อมูล :  </td>
		<td> 	
        	<select name="knowledgetype">
        		<option value="">-- All --</option>
        		<? foreach($knowledgetype as $item):
				$selected = $item['id']==@$_GET['title'] ? 'selected="selected"' : "";
				echo '<option value="'.$item['id'].'" '.$selected.'>'.$item['title'].'</option>';
				endforeach;
				?>
        	</select>
		</td>
        </tr>	
		<tr height="25px">  
		<td>ข้อมูลกลุ่มโรค :</td>   
		<td> 	
        	<select name="knowledgegroup">
        		<option value="">-- All --</option>
        		<? foreach($knowledgegroup as $item):
				$selected = $item['id']==@$_GET['title'] ? 'selected="selected"' : "";
				echo '<option value="'.$item['id'].'" '.$selected.'>'.$item['title'].'</option>';
				endforeach;
				?>
        	</select>
        </td>
		</tr>
	    <tr height="25px">
	    <td>วันที่ :</td>
		<td colspan="2"><input type="text" name="date1" class="datepicker" size="10" value="">	
		ถึง <input type="text" name="date2" class="datepicker" value="" size="10"></td>	 
		</tr>          	
		<tr>
			<td></td><td><input type="submit" name="submit" value="ค้นหา"></td>
		</tr>
	</table>
</fieldset>
</form>
<div id="main-content">
	<table class="tbContainer">
		<tr>
			<td align="left">
			<table width="100%" cellspacing="0" cellpadding="10" border="0">
				<tr class="ui-state-error">
			<th class="ui-state-error tdlist">ลำดับ</th>
			<th class="ui-state-error tdlist">ประเภทข้อมูล</th>
			<th class="ui-state-error tdlist">เรื่อง</th>
			<th class="ui-state-error tdlist">วันเผยแพร่</th>
			<th class="ui-state-error tdlist">จัดการข้อมูล</th>
		</tr>
		<?php 
		  $rowStyle = '';
		  $page = (isset($_GET['page']))? $_GET['page']:1;
		  $i=(isset($_GET['page']))? (($_GET['page'] -1)* 10)+1:1;
		  foreach($dataList as $row):
		?>  
		<tr  <? if($rowStyle =='')$rowStyle = 'class="odd"';else $rowStyle = "";echo $rowStyle;?> >
		  <td class="tdlist"><?=$i;?></td>
		  <td class="tdlist" style="cursor: pointer;" align="left" onclick="window.location='<?=$urlpage;?>/form/<?=$row['id'];?>'">
				<?
						  		echo @$this->db->getone("SELECT title FROM tbknowledgetype WHERE id=".$row['knowledgetypeid']);
				?>
		  </td>
		  <td class="tdlist" style="cursor: pointer;" align="left" onclick="window.location='<?=$urlpage;?>/form/<?=$row['id'];?>'"><?=$row['title'];?></td>
		  <td class="tdlist" style="cursor: pointer;" align="left" onclick="window.location='<?=$urlpage;?>/form/<?=$row['id'];?>'"><?=DB2Date($row['publishdate'])?></td>		
		  <td class="tdlist">
		  	<? if(permission($menu_id, 'candelete')!=''){ ?>
		  	<a href="<?=$urlpage;?>/delete/<?php echo $row['id']?>" style="text-decoration:none;" onclick="return confirm('<?php echo NOTICE_CONFIRM_DELETE?>')"><input type="button" class="btn_delete" /></a>
		  	<? } ?>  	
		  </td>
		  </tr>		
		<? 
				$i++;
		  		endforeach; 
?>		
			</table>
			</td>
		</tr>
	</table>
</div>
